﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestMessageDispatch : View
{
    List<string> regList = null;
    void Start()
    {
        regList = new List<string>();
        regList.Add("msg1");
        regList.Add("msg2");
        regList.Add("msg3");

        RegisterMessage(this, regList);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            facade.SendMessageCommand("msg1", "测试消息分发");
        }
    }

    public override void OnMessage(IMessage message)
    {
        Debug.Log("OnMessage:" + message.Body);
    }

    private void OnDestroy()
    {
        RemoveMessage(this, regList);
    }    
}
